<?php
// 本类由系统自动生成，仅供测试用途
class IndexAction extends Action{
    
	public function index(){
		
		//获取学院公告
    	$Bulletin = new Model('Bulletin');	//等效于 M('Bulletin')
    	
    	$schollBulletinList = $Bulletin->where('type=0')->order('bulletin_id desc')->limit('5')->select();
    	$graduateBulletinList = $Bulletin->where('type=1')->order('bulletin_id desc')->limit('5')->select();
    	$undergraduateBulletinList = $Bulletin->where('type=2')->order('bulletin_id desc')->limit('5')->select();
    	$researchBulletinList = $Bulletin->where('type=3')->order('bulletin_id desc')->limit('5')->select();
    	
    	$this->assign('schollBulletinList',$schollBulletinList);
    	$this->assign('graduateBulletinList',$graduateBulletinList);
    	$this->assign('undergraduateBulletinList',$undergraduateBulletinList);
    	$this->assign('researchBulletinList',$researchBulletinList);
    	
    	
    	//获取学院新闻
    	$News = new Model('News');
    	
    	//学院新闻Top5
    	$top5News = $News->where('type=0')->order('news_id desc')->limit('5')->select();
    	

    	$schollNewslist = $News->where('type=0')->order('news_id desc')->limit('5')->select();
    	$recruitmentNewslist = $News->where('type=1')->order('news_id desc')->limit('5')->select();
    	$studentsNewslist = $News->where('type=2')->order('news_id desc')->limit('5')->select();
    	
    	
    	$this->assign('top5News',$top5News);
    	$this->assign('schollNewslist',$schollNewslist);
    	$this->assign('recruitmentNewslist',$recruitmentNewslist);
    	$this->assign('studentsNewslist',$studentsNewslist);
    	
    	
		//获取快速链接
		$linkModel = new Model('Link');
		$collegeLinks = $linkModel->where("type=0")->select();
		$departmentLinks = $linkModel->where("type=1")->select();
		$otherLinks = $linkModel->where("type=2")->select();
		$this->assign('collegeLinks',$collegeLinks);
		$this->assign('departmentLinks',$departmentLinks);
		$this->assign('otherLinks',$otherLinks);

    	$this->display();
    }
    
}
?>
